package com.amado.course41Annotation;

/**
 * Created by Administrator on 2018/8/4.
 */
public class S01StduentService {
	public static boolean addStudentOld(Student student) {
		if (student == null) {
			return false;
		}
		if (student.getAge() == null || student.getAge() > 120) {
			return false;
		}
		if (student.getTelPhone() == null || student.getTelPhone().length() > 10) {
			return false;
		}
		if (student.getName() == null || student.getName().length() > 10) {
			return false;
		}
		return true;
	}

	public static boolean addStudent(Student student) {
		String errorMsg = S03AnnotataionValue.checkAnnotationValid(student);
		if (errorMsg!=null && !errorMsg.equals("")) {
			System.out.println(errorMsg);
		}
		// 添加学员
		return true;
	}

	public static boolean addTeacher(Teacher teacher) {
		String errorMsg = S03AnnotataionValue.checkAnnotationValid(teacher);
		if (errorMsg!=null && !errorMsg.equals("")) {
			System.out.println(errorMsg);
		}
		// 添加学员
		return true;
	}

	public static void main(String[] args) {
		Teacher teacher = new Teacher("张三李四五12312", "185755883", 300);
		Student student = new Student("张三", "185755883", 300);
		addStudent(student);
		addTeacher(teacher);
	}
}
